import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: H_tao_X
 * Date: 2022-05-19
 * Time: 23:20
 *
 *
 */
// 获取  Post 请求中的参数
@WebServlet("/postGetParameter")
public class PostGetParameterServlet extends HelloServlet {
    @Override
    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
          // 假设传过来的参数是 userId = 10 & classId = 20
        // 服务器也是通过 req.getParameter 来获取内容的

        String userId = req.getParameter("userId");
        String classId = req.getParameter("classId");
        resp.getWriter().write("userId " + userId + ", classId" + classId);
    }
}
